﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>设置运营返利</title>
<link href="../../Client/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../css/admin.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="../js/function.js" type="text/javascript"></script>
<script src="../js/base.js" type="text/javascript"></script>
<script src="../js/dialog.js" type="text/javascript"></script>
<script src="../js/jquery-form.js" type="text/javascript"></script>
<script src="../js/ajax-data.js" type="text/javascript"></script>
<script src="../js/Pager.js" type="text/javascript"></script>
<style>
.foot_btn_box{ text-align:left; margin-left:200px;}
li.selected {height:23px;}
.selected a:hover{ text-decoration:none;}
td input {width:300px; padding-left:5px;}
table{border-collapse: collapse;border: none; text-align:center;}
.list{ min-width:700px;}
.list td{border: solid #ccc 1px;color:Black; height:26px;}

/*分页*/
.pager_style{width:100%;height:30px;margin-top:10px;text-align:left;color:#909090;}
.pager_style li{font-size:14px;}
.pager_style .page_num{height:100%;font-size:0;display:inline-block; float:left;}
.pager_style .page_num li{height:100%;border:1px solid #eeeeee;padding:0 10px;margin-right:5px;line-height:30px;display:inline-block;cursor:pointer;float:left;}
.pager_style .page_num li:hover{border:1px solid #f37b0b;background-color:#f37b0b;color:White;}

/*分页 选中当页样式*/
.pager_style .page_num .active{border:1px solid #f37b0b;background-color:#f37b0b;color:White;cursor:default;}
/*分页 不可用样式*/
.pager_style .page_num .disable{background-color:#f1f1f1;}
.pager_style .page_num .disable:hover{border:1px solid #eeeeee;background-color:#f1f1f1;color:#909090;}

.pager_style .page_info{display:none;float:left;}
.pager_style .page_info li{display:inline-block;margin-left:10px;float:left;line-height: 30px;}
</style>
</head>
<body class="mainbody">
<form id="form1" runat="server">
<div class="navigation"><a href="javascript:" class="back">后退</a>首页 &gt; <a href="list_yunying.html">返利运营商</a> &gt; 设置运营返利</div>
<div id="tab">
    <ul class="tab_nav">
        <li class="selected"><a id="tab1" onclick="tabs('#tab',0);" href="javascript:;">设置运营返利</a></li>
    </ul>

    <div class="tab_con" style="display:block;">
        <table class="form_table">
            <col width="150px"><col>
            <tbody>         
            <tr>
                <th>微街秀ID：</th>
                <td><input type="text" id="user_id" onblur="Get()" maxlength="9" style="width:100px;" /></td>
            </tr>
            <tr>
                <th>名称：</th>
                <td><span id="nick_name"></span> </td>
            </tr>
            <tr>
                <th>手机号：</th>
                <td><span id="phone"></span> </td>
            </tr>
            <tr>
                <th>返利比例：</th>
                <td><input type="text" id="discount" value="0" maxlength="2" style="width:50px" /><label>0 表示不返利，50表示 50%的返利</label></td>
            </tr>           
            </tbody>
        </table>
    </div>
    <div class="foot_btn_box">
        <input type="button" value=" 提 交 " onclick="submits()" />
    </div>
</div>
</form>
<script>
    $(function () {
        $("#name").html(getCookie("adminname"));
        //指定显示选项卡
        if (location.href.indexOf("#tab1") > -1) {
            tabs('#tab', 1);
        }
        if (getQueryString("user_id") != null) {
            $("#user_id").val(getQueryString("user_id"));
            Get();
        }
    });

    var old = "";
    function Get() {
        if (old == $("#user_id").val())
            return;

        $("#phone").html("");
        $("#nick_name").html("");
        $("#discount").val(0);

        var param = "&user_id=" + $("#user_id").val();
        AjaxStart("../ajax/user.ashx?GetDetail", param, function (data) {
            if (data.code != 0) {
                Alert(data.msg);
            }
            else {
                $("#phone").html(data.item.phone);
                $("#nick_name").html(data.item.nick_name);
                if (data.item.discount == null)
                    $("#discount").val("0");
                else
                    $("#discount").val(data.item.yunying_discount);
            }
        });
        old = $("#user_id").val();
    }

    function submits() {
        if (!check())
            return false;
        var param = "user_id=" + $("#user_id").val() + "&discount=" + $("#discount").val();
        AjaxStart("../ajax/user.ashx?fl_setting_yy", param, function (data) {
            if (data.code != 0) {
                Alert(data.msg)
            }
            else {
                Alert("修改成功");
                setTimeout(function () {
                    window.location.href = 'list_yunying.html';
                }, 500);
            }
        });
    }

    function check() {
        var user_id = $("#user_id").val();
        var discount = $("#discount").val();
        if (user_id == "") {
            Alert("请输入微街秀ID");
            return false;
        }
        if (discount == "") {
            Alert("请输入返利比例");
            return false;
        }
        return true;
    }
</script>
</body>
</html>
